package pub.digur.util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import pub.digur.io.Base64OutputStream;

public class Encoder
{
	/**
	 * Computes the Base64 encoding of a string
	 * @param s a string
	 * @return the Base 64 encoding of s
	 */
	public static String base64Encode(String s)
	{
	   ByteArrayOutputStream bOut = new ByteArrayOutputStream();
	   Base64OutputStream b6out = new Base64OutputStream(bOut);
	   try
	   {
	      b6out.write(s.getBytes());
	      b6out.flush();
	   }
	   catch (IOException e)
	   {
	   }
	   return bOut.toString();
	}
}
